<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Royal Garden Hotel</title>
        <link href='http://fonts.googleapis.com/css?family=Merriweather+Sans:400,800' rel='stylesheet' type='text/css'/>
		<link href='http://fonts.googleapis.com/css?family=Prosto+One' rel='stylesheet' type='text/css'/>
        <h:outputStylesheet name="/css/main.css"/>
       
    </h:head>
    <h:body>
        <div id="headerBlock">
			<div class="centerBlock">
			<a href="/RGH/"><img class="logo" src="/RGH/resources/img/logo.png"/></a>
			</div>
		</div>
		<div class="centerBlock">
			<div id="slide">
				<div class="hTitle">ROYAL GARDEN HOTEL	</div>
			</div>
		</div>
        <div class="centerBlock">
            <a href="/RGH/faces/admin.xhtml">admin</a>
        </div>
        
        
        
        
        
        
        <h:outputLink id="userLogin" value="javascript:void(0)" onclick="dlgLogin.show()" title="Авторизация пользователя">
            <p:graphicImage value="/resources/img/login.png" />
        </h:outputLink>
        
        
        <p:growl id="growl" showDetail="true" life="3000" />  
        <p:dialog id="UserLoginDialog" header="Авторизация пользователя" widgetVar="dlgLogin">
            <h:form>
                <h:panelGrid columns="2" cellpadding="5">
                    <h:outputLabel for="email" value="Email:"/>
                    <p:inputText id="email" value="#{userBean.email}" required="true" label="email"/>
                    <h:outputLabel for="password" value="Пароль:"/>
                    <p:inputText id="password" value="#{userBean.password}" required="true" label="password"/>
                    <f:facet name="footer">  
                        <p:commandButton id="loginButton" value="Login" update=":growl"
                                         actionListener="#{userBean.checkUser}"   
                                         oncomplete="handleLoginRequest(xhr, status, args)"/>  
                    </f:facet>  
                </h:panelGrid>
            </h:form> 
        </p:dialog>
         <script type="text/javascript">  
            function handleLoginRequest(xhr, status, args) {  
                if(args.validationFailed || !args.loggedIn) {  
                    jQuery('#UserLoginDialog').effect("shake", { times:3 }, 100);  
                } else {  
                    dlgLogin.hide();  
                    
                    jQuery('#userLogin').fadeOut();  
                }  
            }  
        </script>  
        
    </h:body>
</html>

